package models

import (
	"github.com/jinzhu/gorm"
	db2 "meituan/db"
)

// Roles 角色表
type Roles struct {
	gorm.Model
	Name        string        `gorm:"type:varchar(60)"`
	Permissions []Permissions `gorm:"many2many:roles2permissions"`
}

// TableName 设置角色表名称
func (user Roles) TableName() string {
	return "roles"
}

func init() {
	db, _ := db2.NewDB()
	defer db.Close()
	db.AutoMigrate(new(Roles))
}
